<div class="rights_box">
  <el-row style="margin: 30px">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>角色列表</el-breadcrumb-item>
    </el-breadcrumb>
  </el-row>
  <el-row class="add_box">
    <el-button @click="() => this.addRolesDialog = true" type="warning">添加角色</el-button>
  </el-row>
  <el-row class="rolesList_box">
    <el-table
    :data="rolesList"
    style="width: 100%">
    <el-table-column type="expand">
      <template slot-scope="data">
        <el-row class="first" v-for="first in data.row.children" :key="first.id">
          <el-col :span="4">
            <el-tag closable>{{ first.authName }}</el-tag>
          </el-col>
          <el-col :span="20">
            <el-row class="second" v-for="second in first.children" :key="second.id">
              <el-col :span="4">
                <el-tag closable type="warning">{{ second.authName }}</el-tag>
              </el-col>
              <el-col :span="20">
                <el-col class="third" v-for="third in second.children" :key="third.id" :span="4">
                  <el-tag closable type="success">{{ third.authName }}</el-tag>
                </el-col>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </template>
    </el-table-column>
    <el-table-column
      type="index"
      label="序号"
      width="70">
    </el-table-column>
    <el-table-column
      label="角色名称"
      prop="roleName"
      width="120">
    </el-table-column>
    <el-table-column
      label="角色描述"
      width="200"
      prop="roleDesc">
    </el-table-column>
    <el-table-column
      label="操作">
      <template slot-scope="data">
        <el-tooltip class="item" effect="dark" content="编辑" placement="left">
          <el-button icon="el-icon-edit" size="mini" type="success" circle></el-button>
        </el-tooltip>
        <el-tooltip class="item" effect="dark" content="删除" placement="top">
          <el-button @click="deleteRolesHandler(data.row.id)" icon="el-icon-delete" size="mini" type="danger" circle></el-button>
        </el-tooltip>
        <el-tooltip class="item" effect="dark" content="分配权限" placement="right">
          <el-button icon="el-icon-setting" size="mini" type="primary" circle></el-button>
        </el-tooltip>
      </template>
    </el-table-column>
   </el-table>
  </el-row>
  <!-- 添加角色对话框 -->
  <el-dialog @closed="closeAddRolesDialog" title="添加角色" :visible.sync="addRolesDialog">
    <el-form  ref="addRoles" :rules="addRolesRules" :model="addRolesInfo">
      <el-form-item label="角色名称" prop="roleName" label-width="800">
        <el-input v-model="addRolesInfo.roleName" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="角色描述" prop="roleDesc" label-width="800">
        <el-input v-model="addRolesInfo.roleDesc" autocomplete="off"></el-input>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="() => this.addRolesDialog = false">取 消</el-button>
      <el-button @click="addRolesHandler">添加角色</el-button>
    </div>
  </el-dialog>
</div>